//
//  NSDate+SR.m
//  SportRing
//
//  Created by mykoma on 14-6-16.
//  Copyright (c) 2014年 HotOne. All rights reserved.
//

#import "NSDate+SR.h"

@implementation NSDate (SR)

+(instancetype)baseDate
{
    NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
    dateFormatter.timeZone = [NSTimeZone timeZoneWithAbbreviation:@"GMT+0800"];
    [dateFormatter setDateFormat: @"yyyy-MM-dd HH:mm:ss"];
    return [dateFormatter dateFromString:@"2000-01-01 00:00:00"];
}

-(BOOL)isSameDay:(NSDate *)date
{
    NSDateFormatter * dateFormatter = [[NSDateFormatter alloc] init];
    dateFormatter.timeZone = [NSTimeZone timeZoneWithAbbreviation:@"GMT+0800"];
    [dateFormatter setDateStyle:NSDateFormatterFullStyle];
    NSString * todayString = [dateFormatter stringFromDate:self];
    NSString * otherDateString = [dateFormatter stringFromDate:date];
    return [todayString isEqualToString:otherDateString];
}

@end
